<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bootstrap Material Admin</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
  </head>
  <body>
    <div class="page login-page">
      <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
          <div class="row">
            <!-- Logo & Information Panel-->
            <div class="col-lg-6">
              <div class="info d-flex align-items-center">
                <div class="content">
                  <div class="logo">
                    <h1>欢迎登录</h1>
                  </div>
                </div>
              </div>
            </div>
            <!-- Form Panel    -->
            <div class="col-lg-6 bg-white">
              <div class="form d-flex align-items-center">
                <div class="content">
                    <div class="form-group">
                      <input id="login-email" type="text" name="email" required data-msg="请输入邮件" placeholder="邮件" value="fromlx@126.com" class="input-material" />
                    </div>
                    <div class="form-group">
                      <input id="login-password" type="password" name="passWord" required data-msg="请输入密码" placeholder="密码" class="input-material" />
                    </div>
                    <button id="login" type="submit" class="btn btn-primary">登录</button>
                    <div style="margin-top: -40px;"> 
                    </div>
             
                  <br />
                  <small>没有账号?</small><a href="register.html" class="signup">&nbsp;注册</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <script src="vendor/jquery-validation/jquery.validate.min.js"></script><!--表单验证-->
    <!-- Main File-->
    <script src="js/front.js"></script>
    <script>
    	$(function(){
    		/*判断上次是否勾选记住密码和自动登录*/
    		var oldName=localStorage.getItem("email");
    		var oldPass=localStorage.getItem("passWord");
    		
    		$("#login").click(function(){
    			var email=$("#login-email").val();
    			var passWord=$("#login-password").val();
    			/*获取当前输入的账号密码*/
    			localStorage.setItem("email",email)
    			localStorage.setItem("passWord",passWord)
    			
    			$.get("http://localhost:9002/api/user/login/"+email+"/"+passWord,function(data){
                        var jsonStr = $.parseJSON(data);
                        if (jsonStr.code==true) {
                            location="welcome.html?email="+jsonStr.email;
                        } else {
                            alert(jsonStr.msg);
                        };
                    
                    });
    		})
    		
    	})
    </script>
  </body>
</html>